package com.xysl.mapper;



import com.xysl.api.domain.XyslMenu;
import com.xysl.api.domain.XyslUser;
import com.xysl.domain.dto.XyslMenuDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户Mapper接口
 *
 * @author xysl
 * @date 2024-12-27
 */
@Mapper
public interface XyslUserMapper
{
    /**
     * 查询用户
     *
     * @param id 用户主键
     * @return 用户
     */
    public XyslUser selectXyslUserById(Long id);

    public XyslUser queryXyslUserByAccount(String account);

    @Select("<script>" +
            "select * from zl_menu a " +
            "left join zl_role_menu zrm on a.id = zrm.menu_id " +
            "left join zl_user_roles zur on zrm.role_id = zur.role_id " +
            "where a.status = 0 and zur.user_id = #{userId} " +
            "<if test='parentId != null'>" +
            "  and a.parent_id = #{parentId} " +
            "</if>" +
            "</script>")
    public List<XyslMenu> queryLoginUserMenuList(XyslMenuDTO menuDTO);

}
